-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: ox_lib, core exports, switch notify, network vehicles #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generalized comments as all of them apply to multiple instances
end | ||
end | ||
|
||
elseif #(pos - vector3(Config.Locations.inside.coords.x, Config.Locations.inside.coords.y, Config.Locations.inside.coords.z)) < 1.5 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Config.Locations.inside.coords.xyz
instead, same for all the other instances
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you like it done that way or just .coords?
lib.hideTextUI() | ||
end, | ||
inside = function() | ||
if IsPedInAnyVehicle(cache.ped, false) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of IsPedInAnyVehicle
everywhere you can just check if cache.vehicle
is not false (aka if cache.vehicle then
)
mic_net = netid | ||
holdingMic = true | ||
else | ||
ClearPedSecondaryTask(GetPlayerPed(PlayerId())) | ||
ClearPedSecondaryTask(GetPlayerPed(cache.playerId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetPlayerPed(cache.playerId)
everywhere is useless when you have cache.ped
local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(PlayerId()), 0.0, 0.0, -5.0) | ||
local camspawned = CreateObject(GetHashKey(camModel), plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1) | ||
local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(cache.playerId), 0.0, 0.0, -5.0) | ||
local camspawned = CreateObject(camModel, plyCoords.x, plyCoords.y, plyCoords.z, 1, 1, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to wrap camModel in joaat to make this work
DisableControlAction(0,25,true) -- disable aim | ||
DisableControlAction(0, 44, true) -- INPUT_COVER | ||
DisableControlAction(0,37,true) -- INPUT_SELECT_WEAPON | ||
SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true) | ||
SetCurrentPedWeapon(cache.ped, joaat("WEAPON_UNARMED"), true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When converting literal strings to a hash, use `` around the string instead of quotes to do it faster
DisableControlAction(0,25,true) -- disable aim | ||
DisableControlAction(0, 44, true) -- INPUT_COVER | ||
DisableControlAction(0,37,true) -- INPUT_SELECT_WEAPON | ||
SetCurrentPedWeapon(PlayerPedId(), GetHashKey("WEAPON_UNARMED"), true) | ||
SetCurrentPedWeapon(cache.ped, joaat("WEAPON_UNARMED"), true) | ||
Wait(7) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert to wait 0 as well, as waiting 7 will cause issues for the high end users
local scaleform = lib.requestScaleformMovie("security_camera") | ||
local scaleform2 = lib.requestScaleformMovie("breaking_news") | ||
|
||
local vehicle = GetVehiclePedIsIn(cache.ped) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use cache.vehicle
SetCamFov(cam2, fov) | ||
RenderScriptCams(true, false, 0, 1, 0) | ||
PushScaleformMovieFunction(scaleform, "SET_CAM_LOGO") | ||
PushScaleformMovieFunction(scaleform2, "breaking_news") | ||
PopScaleformMovieFunctionVoid() | ||
while newscamera and not IsEntityDead(lPed) and (GetVehiclePedIsIn(lPed) == vehicle) and true do | ||
while newscamera and not IsEntityDead(cache.ped) and (GetVehiclePedIsIn(cache.ped) == vehicle) and true do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the last true as it's useless
local bmicspawned = CreateObject(GetHashKey(bmicModel), plyCoords.x, plyCoords.y, plyCoords.z, true, true, false) | ||
lib.requestModel(bmicModel) | ||
local plyCoords = GetOffsetFromEntityInWorldCoords(GetPlayerPed(cache.playerId), 0.0, 0.0, -5.0) | ||
local bmicspawned = CreateObject(bmicModel, plyCoords.x, plyCoords.y, plyCoords.z, true, true, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use joaat on bmicModel for this to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesnt this already take place with lib.requestModel?
Description
Further implementation of ox_lib, switch to code exports and notification exports, and set up vehicle spawning server side.
Vehicle spawning works now but object spawning still DOES NOT. Other than oxifying camera.lua, I have not fiddled with the object spawning as I am not sure how you'd like to deal with the server sided spawning for them. This is another resource which needs to be refactored further.
Checklist